<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<div *ngIf="jobDetail && !isLoading" class="wrapper">
  <div class="name">
    <h2>{{ jobDetail.name }}</h2>
    <nz-divider [nzType]="'vertical'"></nz-divider>
    <flink-job-badge [state]="jobDetail.state"></flink-job-badge>
    <nz-divider [nzType]="'vertical'"></nz-divider>
    <flink-task-badge [tasks]="jobDetail['status-counts']"></flink-task-badge>
  </div>
  <div class="status">
    <div class="field">
      <div>ID:</div>
      <div>{{ jobDetail.jid }}</div>
    </div>
    <nz-divider [nzType]="'vertical'"></nz-divider>
    <div class="field">
      <div>Start Time:</div>
      <div>{{ jobDetail['start-time'] | date:'yyyy-MM-dd HH:mm:ss' }}</div>
    </div>
    <nz-divider [nzType]="'vertical'"></nz-divider>
    <ng-container *ngIf="jobDetail['end-time']>-1">
      <div class="field">
        <div>End Time:</div>
        <div>{{ jobDetail['end-time'] | date:'yyyy-MM-dd HH:mm:ss' }}</div>
      </div>
      <nz-divider [nzType]="'vertical'"></nz-divider>
    </ng-container>
    <div class="field">
      <div>Duration:</div>
      <div>{{ jobDetail.duration | humanizeDuration}}</div>
    </div>
  </div>
  <flink-navigation [listOfNavigation]="listOfNavigation"></flink-navigation>
  <div class="operate">
    <span *ngIf="statusTips">{{ statusTips }}</span>
    <ng-container *ngIf="!statusTips">
      <a nz-popconfirm nzTitle="Cancel Job?" (nzOnConfirm)="cancelJob()" *ngIf="jobDetail.state=='RUNNING' || jobDetail.state=='CREATED' || jobDetail.state=='RESTARTING'">Cancel Job</a>
    </ng-container>
  </div>
</div>
<nz-skeleton [nzActive]="true" *ngIf="isLoading"></nz-skeleton>
